<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="/layout/template.xhtml">

	<ui:define name="body">
		<rich:panel>
			<f:facet name="header">Perfil de #{usuarioPerfilHome.instance.nome}</f:facet>
			
			<s:decorate id="nome" template="/layout/display.xhtml">
            	<ui:define name="label">Nome</ui:define>
            	<h:outputText value="#{usuarioPerfilHome.instance.nome}"/>
        	</s:decorate>
        	
        	<s:decorate id="dataCadastro" template="/layout/display.xhtml">
            	<ui:define name="label">Data de Cadastro</ui:define>
            	<h:outputText value="#{usuarioPerfilHome.instance.dataCadastro.time}"/>
        	</s:decorate>
        	
        	<s:decorate id="email" template="/layout/display.xhtml">
            	<ui:define name="label">E-mail</ui:define>
            	<h:outputText value="#{usuarioPerfilHome.instance.email}"/>
        	</s:decorate>
        	
        	<s:decorate id="status" template="/layout/display.xhtml">
            	<ui:define name="label">Status</ui:define>
            	<h:outputText value="#{usuarioPerfilHome.instance.status}"/>
        	</s:decorate>
        	
        	<s:decorate id="subGrupo" template="/layout/display.xhtml">
            	<ui:define name="label">Subgrupo</ui:define>
            	<h:outputText value="#{usuarioPerfilHome.instance.subGrupo.nome}"/>
        	</s:decorate>
        	
        	<div style="clear:both"/>
        	
		</rich:panel>
		
		<br clear="left"/>
		
		<div class="actionButtons">

	        <s:button view="/resources/UsuarioEdit.xhtml"
	                    id="edit"
	                 	value="Editar">
	        	<f:param name="usuarioId" value="#{usuarioPerfilHome.instance.id}"/>
	        	<f:param name="usuarioFrom" value="UsuarioPerfil"/>
	        </s:button>
	    </div>
	    
	    <br clear="left"/>
	    
	    <h:form>
		    
		    <rich:panel> 
		    	<f:facet name="header">Categoria</f:facet>
		    
		    	<h:outputText rendered="#{empty usuarioPerfilHome.categoria}" value="Não existe nenhuma Categoria cadastrada."/>
		    	
		    	<rich:dataTable value="#{usuarioPerfilHome.categoria}"
	                       var="_categoria"
	                  rendered="#{not empty usuarioPerfilHome.categoria}"
	                rowClasses="odd,even"
	                        id="categoriaTable">
	                        
					<rich:column sortBy="#{_categoria.nome}">
		                <f:facet name="header">Nome</f:facet>
		                <h:outputText value="#{_categoria.nome}"/>
		            </rich:column>
		            <rich:column sortBy="#{_categoria.descricao}">
		                <f:facet name="header">Descrição</f:facet>
		                <h:outputText value="#{_categoria.descricao}"/>
		            </rich:column>
		            <rich:column style="text-align: center;">
		                <f:facet name="header">Opções</f:facet>
		                <s:link id="selectcategoria"
		                     value="Ver"
		                      view="/resources/Categoria.xhtml">
		                    <f:param name="categoriaId"
		                            value="#{_categoria.id}"/>
		                    <f:param name="categoriaFrom" value="UsuarioPerfil"/>
		                </s:link>
		            </rich:column>
				</rich:dataTable>
		    </rich:panel>
		</h:form>
	</ui:define>
</ui:composition>